<div class="titlepanel"><?php __('Players'); ?><a href="#" title="Refresh" id="refreshplayerpanel"><span style="float:right;margin-right:5px" class=" ui-state-default ui-corner-all ui-icon ui-icon-refresh"></span></a></div>
<div class="opaque ui-widget-content contentpanel" style="height:500px;">
<div class="module" id="playersonline">
<div class="modulebottom">
<style>
#list_items div.titlepanel,#player_inventory div.titlepanel,#trash_items div.titlepanel {cursor:move};
</style>
<script>
var player;
$("#player_inventory").draggable({handle:'div.titlepanel'});
$("#list_items").draggable({handle:'div.titlepanel'});
$("#trash_items").draggable({handle:'div.titlepanel'});
</script>
<h3><?php __('Players online');?></h3>
<?php
if (!empty($players) && (!empty($players['players'])))
{
	foreach($players['players'] as $player)
	{
		echo $player.' ';
		echo $this->Js->link
		(
		'Kick',
		array('controller' => 'private','action'=>'kick_player'),
		array(
		'type'=>'json',
		'method'=>'post',
		'update' => '#playerpanel',
		'data'=>"player=".$player,
		'class'=>'mainlevel-nav',
		'buffer'=>false
		)
			);
		echo ' '.$html->link('Pm',"#",array('onclick'=>'messageToPlayer("'.$player.'")'));
		echo ' '.$this->Js->link
		(
		'Inv',
		array('controller' => 'private','action'=>'show_inv'),
		array(
		'type'=>'json',
		'method'=>'post',
		'update' => '#player_inventory',
		'data'=>"player=".$player,
		'class'=>'mainlevel-nav',
		'success' => '$("#trash_items").fadeIn();$("#list_items").fadeIn();$("#player_inventory").fadeIn();player="'.$player.'";',
		'buffer'=>false
		)
			);
		echo "<br>";
		};
}
?>
<hr/>
<?php
echo ' '.$html->link(__('Send message to All',true),"#",array('onclick'=>'messageToPlayer("")'));
?>
</div>
</div>
<div id="player_inventory" style="float:left;display:none">
<?php echo $this->element("show_inv"); ?>
</div>
<div id="list_items" style="margin-left:10px;float:left;width:270px;display:none">
<?php echo $this->element("show_list_items"); ?>
</div>
<div id="trash_items" style="margin-left:10px;float:left;width:270px;display:none">
<?php echo $this->element("trash_items"); ?>
</div>
</div>

<?php
$this->Js->get('#refreshplayerpanel');
$this->Js->event('click',
$this->Js->request(
array('controller' => 'private','action'=>'refresh_player_panel'),
array(
'type'=>'json',
'method'=>'post',
'update' => '#playerpanel',
'data'=> 'null',
'dataExpression' => true,
'complete' => '$.unblockUI();',
'error'=>'alert("'.__('An unexpected error has occurred!',true).'");'							
	)));

echo $this->Js->writeBuffer();
?>